import 'package:flutter/material.dart';
import 'package:hi_net/util/color.dart';

import '../model/barrage_model.dart';

class BarrageViewUtil {
  //如果想定义弹幕样式，可以在这里根据弹幕的类型来定义
  static barrageView(BarrageModel model) {
    switch (model.type) {
      case 1:
        return _barrageType1(model);
      case 2:
        return _barrageType2(model);
      default:
        return Text(model.content, style: const TextStyle(color: Colors.white));
    }
  }

  static _barrageType1(BarrageModel model) {
    return Text(model.content, style: const TextStyle(color: Colors.deepOrangeAccent));
  }

  static _barrageType2(BarrageModel model) {
    return Center(
      child: Container(
        decoration: BoxDecoration(border: Border.all(color: primary), borderRadius: BorderRadius.circular(15)),
        padding: const EdgeInsets.symmetric(horizontal: 10),
        child: Text(model.content, style: const TextStyle(color: primary)),
      ),
    );
  }
}
